﻿CREATE TRIGGER [tr_Employment_Phone]
ON [dbo].[t_Employment]
FOR UPDATE
AS

SET NOCOUNT ON

IF NOT UPDATE(Phone) RETURN

IF EXISTS(SELECT * FROM inserted WHERE Phone <> dbo.CleanPhone(Phone))
	UPDATE E SET Phone = dbo.CleanPhone(E.Phone)
	FROM t_Employment E INNER JOIN inserted i ON E.ID = i.ID
